// Fill out your copyright notice in the Description page of Project Settings.


#include "StoneProcessLib.h"

#include "Windows/AllowWindowsPlatformTypes.h"
#include "Windows.h"
#include "Windows/HideWindowsPlatformTypes.h"
#include <process.h>

bool UStoneProcessLib::KillProcess(int id) 
{
	if (id > 0) 
	{
		HANDLE killHandle = OpenProcess(PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION |   // Required by Alpha
			PROCESS_CREATE_THREAD |   // For CreateRemoteThread
			PROCESS_VM_OPERATION |   // For VirtualAllocEx/VirtualFreeEx
			PROCESS_VM_WRITE,             // For WriteProcessMemory);
			false, id);

		if (killHandle == NULL)
			return false;

		TerminateProcess(killHandle, 0);
		return true;
	}

	return false;
}


int UStoneProcessLib::GetNowProcessID() 
{

	int iPid = (int)_getpid();
	return iPid;

	return -1;
}